package com.pro.service.imple;

import com.google.gson.Gson;
import com.pro.mapper.JsKeyWordHeatStatisticsMapper;
import com.pro.pojo.JsSearchKeyWords;
import com.pro.service.JsKeyWordHeatStatisticsService;
import com.pro.utils.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsKeyWordHeatStatisticsServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2021/12/8 19:45
 * @Author: XJR
 */
@Service
public class JsKeyWordHeatStatisticsServiceImple implements JsKeyWordHeatStatisticsService {
    @Autowired
    private JsKeyWordHeatStatisticsMapper mapper;

    @Autowired
    private RedisCache redisCache;

    private Gson gson = new Gson();

    //查看关键字热度统计
    public List<JsSearchKeyWords> selectKeyWords(){
        List<JsSearchKeyWords> jsSearchKeyWords = mapper.selectKeyWords();
        redisCache.setCacheObject("selectKeyWords",gson.toJson(jsSearchKeyWords));
        return jsSearchKeyWords;
    };
}
